// 通用响应类型
export interface ApiResponse<T = any> {
  success: boolean
  data: T
  message: string
  code: number
}

// 分页响应类型
export interface PageResponse<T> {
  content: T[]
  totalElements: number
  totalPages: number
  size: number
  number: number
}

// 生命体相关类型
export interface LifeEntity {
  id: string
  name: string
  type: LifeEntityType
  status: LifeEntityStatus
  consciousnessLevel: ConsciousnessLevel
  description?: string
  energyLevel: number
  healthScore: number
  wisdomScore: number
  creativityScore: number
  collaborationScore: number
  lastActiveAt: string
  birthTime: string
  evolutionCount: number
  lastEvolutionAt?: string
  parentId?: string
  createdAt: string
  updatedAt: string
  ageInDays: number
  ageInHours: number
  isActive: boolean
  isOperational: boolean
}

// 创建生命体请求类型
export interface LifeEntityCreateRequest {
  name: string
  type: LifeEntityType
  description?: string
  parentId?: string
  configuration?: string
  metadata?: string
}

// 更新生命体请求类型
export interface LifeEntityUpdateRequest {
  name?: string
  type?: LifeEntityType
  status?: LifeEntityStatus
  consciousnessLevel?: ConsciousnessLevel
  description?: string
  configuration?: string
  metadata?: string
}

export enum LifeEntityType {
  CORPORATE = 'CORPORATE',
  URBAN = 'URBAN',
  CONCEPTUAL = 'CONCEPTUAL',
  INDIVIDUAL = 'INDIVIDUAL',
  HYBRID = 'HYBRID',
  SYSTEM = 'SYSTEM',
}

export enum LifeEntityStatus {
  ACTIVE = 'ACTIVE',
  INACTIVE = 'INACTIVE',
  EVOLVING = 'EVOLVING',
  DORMANT = 'DORMANT',
}

// 意识状态类型
export interface ConsciousnessState {
  id: string
  lifeEntityId: string
  level: ConsciousnessLevel
  awareness: number
  focus: number
  creativity: number
  empathy: number
  createdAt: string
  updatedAt: string
}

export enum ConsciousnessLevel {
  BASIC = 'BASIC',
  INTERMEDIATE = 'INTERMEDIATE',
  ADVANCED = 'ADVANCED',
  TRANSCENDENT = 'TRANSCENDENT',
}

// 数字DNA类型
export interface DigitalDNA {
  id: string
  lifeEntityId: string
  sequence: string
  traits: Record<string, any>
  generation: number
  createdAt: string
  updatedAt: string
}

// 网络关系类型
export interface LifeEntityRelationship {
  id: string
  sourceEntityId: string
  targetEntityId: string
  relationshipType: string
  strength: number
  description?: string
  createdAt: string
  updatedAt: string
}

// 网络可视化数据类型
export interface NetworkVisualizationData {
  nodes: NetworkNode[]
  edges: NetworkEdge[]
}

export interface NetworkNode {
  id: string
  name: string
  type: LifeEntityType
  status: LifeEntityStatus
  x?: number
  y?: number
}

export interface NetworkEdge {
  id: string
  source: string
  target: string
  type: string
  strength: number
}
